package com.beadhouse.base.web.advicehandler;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import com.beadhouse.common.exeption.BeadHouseException;

@ControllerAdvice
public class AdviceHandler {
	@ExceptionHandler
	public ModelAndView BeadHouseExceptionHandler(Exception e) {
		ModelAndView mav=new ModelAndView("error");
		if(e instanceof BeadHouseException) {
			mav.addObject("e",e.getMessage());
		}else {
			e.printStackTrace();
			mav.addObject("e","系统异常请稍后");
		}
		return mav;
	}
}
